#ifndef FILEMESSAGE_H
#define FILEMESSAGE_H

#include<QSize>
#include"../global.h"
#include "qqmlapplicationengine.h"

class FileMessage : public QWidget
{
    Q_OBJECT
public:
    explicit FileMessage(const QString &path, const NewsType &FType, QWidget *parent = nullptr);
    ~FileMessage();
    QSize sizeHint() const override;

protected:
    void mousePressEvent(QMouseEvent *);
    void enterEvent(QEnterEvent *) override {
        // 进入区域，改变光标形状
        setCursor(Qt::PointingHandCursor);
    }
    void leaveEvent(QEvent *) override {
        // 离开区域，恢复默认光标
        unsetCursor();
    }

private:
    void picture();
    void video();
    void rests();

private:
    QString path;
    QSize sizeH;
    NewsType n;
    QQmlApplicationEngine *engine = nullptr;
};

#endif // FILEMESSAGE_H
